﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSell
{
    public partial class BauVatVTCGame : System.Web.UI.Page
    {

        private DataObject dao;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                dao = new DataObject();
            }
        }

        protected void DrdlLoaiThe_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DrdlLoaiThe.SelectedIndex==0)
            {
                txtSoSeri.Text = "PM";
                lblMathevcoin.Text = "Mã thẻ Vcoin";                
                lblMathevcoin.Visible = true;
                txtMatheVcoin.Visible = true;
            }
            if (DrdlLoaiThe.SelectedIndex==1)
            {

                txtSoSeri.Text = "VG";
                lblMathevcoin.Text = "Mã thẻ VGold";                
                lblMathevcoin.Visible = true;
                txtMatheVcoin.Visible = true;
            }
            if (DrdlLoaiThe.SelectedIndex == 2)
            {
                lblSoseri.Text = "Mã thẻ Mobifone";
                txtSoSeri.Text = string.Empty;
                txtMatheVcoin.Text = string.Empty;
                lblMathevcoin.Visible = false;
                txtMatheVcoin.Visible = false;

            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string LoaiThe = DrdlLoaiThe.SelectedItem.Text;
                string SoSeri = txtSoSeri.Text;
                string MaVcoin = "";
                if (txtMatheVcoin.Visible)
                {
                    MaVcoin = txtMatheVcoin.Text;
                }
                string TaiKhoan = txtTaikhoanVTC.Text;

                SeriCard sc = new SeriCard();
                sc.LoaiThe = LoaiThe;
                sc.SoSeri = SoSeri;
                sc.MaVcoin = MaVcoin;
                sc.TaiKhoan = TaiKhoan;

                dao.AddSeriCard(sc);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}